<%@ page language="java" pageEncoding="UTF-8" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
    String categoryId = request.getParameter("categoryId");
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <base href="<%=basePath%>">

    <title>添加
    </title>
    <link type="text/css" href="<%=basePath%>/css/base2.css" rel="stylesheet"/>
    <script type="text/javascript" src="<%=basePath%>/js/jquery.min.js"></script>
    <script type="text/javascript" src="<%=basePath%>/js/menu.js"></script>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <link rel="stylesheet" type="text/css" href="<%=basePath%>/css/themes/default/easyui.css">
    <link rel="stylesheet" type="text/css" href="<%=basePath%>/css/themes/icon.css">
    <script type="text/javascript" src="<%=basePath%>/js/jquery.min.js"></script>
    <link href='<%=basePath%>/css/bootstrap-2.3.2.css' rel='stylesheet'>
    <script type="text/javascript" src="<%=basePath%>/js/bootstrap.min.js"></script>
    <script type="text/javascript" src="<%=basePath%>/js/jquery.pnotify.js"></script>
    <link href="<%=basePath%>/css/jquery.pnotify.default.css" rel="stylesheet">
    <script type="text/javascript" src="<%=basePath%>/js/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="<%=basePath%>/js/ueditor.config.js"></script>
    <script type="text/javascript" src="<%=basePath%>/js/ueditor.all.min.js"></script>
    <script type="text/javascript" src="<%=basePath%>/js/zh-cn.js"></script>

    <script src='<%=basePath%>dwr/util.js' type="text/javascript"></script>
    <script src='<%=basePath%>dwr/engine.js' type="text/javascript"></script>
    <script src='<%=basePath%>dwr/interface/subjectService.js' type="text/javascript"></script>
    <script src='<%=basePath%>dwr/interface/testCategoryService.js' type="text/javascript"></script>

    <script src='<%=basePath%>/js/subject.js' type="text/javascript"></script>
    <script type="text/javascript" src="<%=basePath%>/js/category.js"></script>
    <script type="text/javascript" src="<%=basePath%>/js/addTest.js"></script>
    <script type="text/javascript" src="<%=basePath%>/js/icheck.js"></script>

    <link href="<%=basePath%>/css/custom.css" rel="stylesheet">
    <link href="<%=basePath%>/css/line/_all.css" rel="stylesheet">
    <link href="<%=basePath%>/css/square/_all.css" rel="stylesheet">
    <!--
     <link rel="stylesheet" type="text/css" href="styles.css">
     -->
    <style type="text/css">
        table {
            margin: 0 auto;
        }

        table tr td {
            height: 45px;
        }

        .clear {
            clear: both;
        }

        #filling {
            border: 1px solid #CCCCCC;
            margin-bottom: 30px;
            min-height: 30px;
            padding: 5px;
            width: 600px;
            height: 100px;
        }

        #content .edui-default table {
            margin: 0 auto;
        }

        .theButton {
            width: 150px;
            margin: 5px;
            height: 25px;
            cursor: pointer;
            border: none;
            background: #2569c1;
            color: white;
            font-size: 14px;
        }

        .choicesTd {
            vertical-align: top;
            position: relative;
            width: 100px;
        }

    </style>
    <script type="text/javascript">
        $(document).ready(function () {
            $('.skin-square input').iCheck({
                checkboxClass: 'icheckbox_square-blue',
                radioClass: 'iradio_square-blue',
                increaseArea: '20%'
            });
            $('.skin-line input').each(function () {
                var self = $(this),
                        label = self.next(),
                        label_text = label.text();

                label.remove();
                self.iCheck({
                    checkboxClass: 'icheckbox_line-blue',
                    radioClass: 'iradio_line-blue',
                    insert: '<div class="icheck_line-icon"></div>' + label_text
                });
            });

            testCategoryService.findTestCategoryById(<%=categoryId%>, getType);
            UE.getEditor('editor');
        });

    </script>
</head>

<body>
<%@ include file="/page/share/menu.jsp" %>

<div id="content">
    <h2></h2>
    <hr>
    <%--    <button onclick="getPlainTxt()">获得带格式的纯文本</button>
        <button onclick="hasContent()">判断是否有内容</button>
        <button onclick="setFocus()">使编辑器获得焦点</button>
        <button onmousedown="isFocus(event)">编辑器是否获得焦点</button>
        <button onmousedown="setblur(event)" >编辑器失去焦点</button>
        <button onclick="getContent()">获得内容</button>--%>


    <form action="Test.action" method="post" onsubmit="return submitForm()">
        <input type="hidden" name="owner" value="${person.accout}"/>
        <input type="hidden" name="theme" id="theme" value=""/>
        <input type="hidden" name="choices" id="choices" value=""/>
        <input type="hidden" name="category" value="<%=categoryId%>"/>
        <table>
            <tr>
                <td colspan="2">
                    <h2 id="theProblemH3">题干添加</h2>

                    <div id="theProblem">
                        <div id="showProblem" onclick="showEditor('editor','editTheTheme','finish','showProblem')"></div>
                        <script id="editor" type="text/plain" style="width:700px;height:300px;"></script>
                        <button type="button" onclick="showEditor('editor','editTheTheme','finish','showProblem')"
                                onMouseOver="this.style.background='#2569c1'"
                                onmouseout="this.style.background='#114a93'"
                                style="display: none;" class="theButton"
                                id="editTheTheme">编辑题干
                        </button>
                        <button type="button" onclick="hideTheThemeEditor('editor')" id="finish"
                                onMouseOver="this.style.backgroundColor='#2569c1'"
                                onmouseout="this.style.backgroundColor='#114a93'"
                                class="theButton">编辑完成
                        </button>
                    </div>

                </td>
            </tr>
            <tr id="addChoiceH3">
                <td colspan="2">
                    <h2>答案添加</h2>
                </td>
            </tr>
            <tr id="addChoice">
                <td>
                    &nbsp;
                </td>
                <td>
                    <button type="button"
                            onclick="createSingleChoice()" onMouseOver="this.style.backgroundColor='#2569c1'"
                            onmouseout="this.style.backgroundColor='#114a93'"
                            class="theButton">添加选项
                    </button>
                    <button type="button" onclick="deleteChoice()" onMouseOver="this.style.backgroundColor='#2569c1'"
                            onmouseout="this.style.backgroundColor='#114a93'"
                            class="theButton">减少选项
                    </button>
                </td>
            </tr>
            <tr id="subjectTd">
                <td align="center">科目：
                </td>
                <td align="left">
                    <select name="subject" class="form-control" id="subject" style="width: 287px;height: 45px;font-size: 18px;
                    text-align:center;">
                    </select>
                </td>

            </tr>

            <tr>
                <td align="center">
                    答案解析：
                </td>
                <td align="left">
                    <textarea rows="3" cols="30" class="form-control" name="answerKeys"></textarea>
                </td>
            </tr>
            <tr>
                <td align="center">
                    是否共享：
                </td>
                <td align="center">
                    <div class="skin skin-line">
                        <div class="skin-section">
                            <ul class="list">
                                <li>
                                    <input tabindex="19" type="radio" id="line-radio-1" name="share" value="1">
                                    <label for="line-radio-1">共享</label>
                                </li>
                            </ul>
                            <ul class="list">

                                <li>
                                    <input tabindex="20" type="radio" id="line-radio-2" name="share" value="0"
                                           checked>
                                    <label for="line-radio-2">不共享</label>
                                </li>
                            </ul>
                        </div>
                    </div>
                </td>
            </tr>
            <tr>
                <td>
                    &nbsp;
                </td>
                <td colspan="2" align="left">
                    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
                    <input type="submit" name="sb" value="添加" onMouseOver="this.style.backgroundColor='#2569c1'"
                           onmouseout="this.style.backgroundColor='#114a93'"
                           class="theButton"/>
                </td>

            </tr>


        </table>
    </form>
</div>

<div id="footer">
    <p style="text-align: center;color: #757575;padding: 20px 0px 0px 0px; font:12px;">Copyright © 2010-2013 蓝天白云团队
        版权所有</p>
</div>
</body>
</html>
